<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>县城小超市ERP系统</title>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
  <style>
    :root {
      --primary: #2563eb;
      --secondary: #3b82f6;
      --success: #10b981;
      --warning: #f59e0b;
      --danger: #ef4444;
      --light: #f8fafc;
      --dark: #1e293b;
      --dark-blue: #0f172a;
      --gray: #64748b;
      --border: #e2e8f0;
      --bg-gradient: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%);
      --card-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    }

    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
      font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    }

    body {
      background: var(--bg-gradient);
      color: var(--light);
      min-height: 100vh;
      overflow-x: hidden;
      touch-action: manipulation;
      -webkit-tap-highlight-color: transparent;
    }

    /* 强制横屏提示 */
    .orientation-warning {
      display: none;
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(0,0,0,0.95);
      color: white;
      z-index: 1000;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      text-align: center;
      padding: 25px;
    }

    .orientation-warning i {
      font-size: 5rem;
      margin-bottom: 25px;
      color: var(--warning);
      animation: rotate 2s infinite linear;
    }

    @keyframes rotate {
      from { transform: rotate(0deg); }
      to { transform: rotate(360deg); }
    }

    .orientation-warning h2 {
      font-size: 2rem;
      margin-bottom: 15px;
      background: linear-gradient(90deg, #f59e0b, #fde047);
      -webkit-background-clip: text;
      background-clip: text;
      color: transparent;
    }

    .orientation-warning p {
      font-size: 1.2rem;
      max-width: 500px;
      line-height: 1.6;
    }

    @media screen and (orientation: portrait) {
      .orientation-warning {
        display: flex;
      }
    }

    /* 主容器 */
    .container {
      display: flex;
      min-height: 100vh;
      max-width: 100%;
      margin: 0 auto;
      overflow: hidden;
    }

    /* 侧边导航 */
    .sidebar {
      width: 85px;
      background: rgba(21, 39, 77, 0.8);
      backdrop-filter: blur(10px);
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: 25px 0;
      border-right: 1px solid rgba(255, 255, 255, 0.08);
      z-index: 10;
    }

    .logo {
      width: 50px;
      height: 50px;
      background: var(--primary);
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      margin-bottom: 30px;
      box-shadow: 0 4px 10px rgba(37, 99, 235, 0.4);
    }

    .logo i {
      font-size: 1.8rem;
    }

    .nav-item {
      width: 100%;
      padding: 18px 0;
      text-align: center;
      cursor: pointer;
      transition: all 0.3s;
      position: relative;
      color: rgba(255, 255, 255, 0.7);
    }

    .nav-item.active {
      background: rgba(255, 255, 255, 0.1);
      color: white;
    }

    .nav-item::before {
      content: '';
      position: absolute;
      left: 0;
      top: 0;
      height: 100%;
      width: 4px;
      background: var(--primary);
      transform: scaleY(0);
      transition: transform 0.3s;
    }

    .nav-item.active::before {
      transform: scaleY(1);
    }

    .nav-item i {
      font-size: 1.5rem;
      margin-bottom: 8px;
    }

    .nav-item .label {
      font-size: 0.8rem;
    }

    .nav-item:hover {
      background: rgba(255, 255, 255, 0.08);
      color: white;
    }

    /* 主内容区域 */
    .main-content {
      flex: 1;
      padding: 25px;
      overflow-y: auto;
      background: rgba(15, 23, 42, 0.65);
      overflow-x: hidden;
    }

    .page {
      display: none;
      animation: fadeIn 0.4s ease-out;
    }

    @keyframes fadeIn {
      from { opacity: 0; transform: translateY(15px); }
      to { opacity: 1; transform: translateY(0); }
    }

    .page.active {
      display: block;
    }

    .page-header {
      margin-bottom: 30px;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .page-title {
      font-size: 1.8rem;
      font-weight: 700;
      background: linear-gradient(90deg, #ffffff, #dbeafe);
      -webkit-background-clip: text;
      background-clip: text;
      color: transparent;
    }

    .page-subtitle {
      color: var(--gray);
      margin-top: 8px;
      font-size: 1.05rem;
    }

    /* 卡片样式 */
    .card {
      background: rgba(30, 41, 59, 0.7);
      border-radius: 16px;
      box-shadow: var(--card-shadow);
      padding: 25px;
      margin-bottom: 25px;
      border: 1px solid rgba(255, 255, 255, 0.08);
      backdrop-filter: blur(8px);
      transition: transform 0.3s, box-shadow 0.3s;
    }

    .card:hover {
      transform: translateY(-5px);
      box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
    }

    .card-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 20px;
      padding-bottom: 15px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .card-title {
      font-size: 1.2rem;
      font-weight: 600;
      color: white;
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .card-title i {
      color: var(--primary);
    }

    /* 按钮样式 */
    .btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 12px 20px;
      border-radius: 10px;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.25s;
      border: none;
      outline: none;
      font-size: 1rem;
      height: 46px;
      gap: 8px;
    }

    .btn i {
      font-size: 1.05rem;
    }

    .btn-primary {
      background: var(--primary);
      color: white;
      box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
    }

    .btn-primary:hover {
      background: var(--secondary);
      transform: translateY(-2px);
      box-shadow: 0 6px 14px rgba(59, 130, 246, 0.4);
    }

    .btn-outline {
      background: transparent;
      color: var(--primary);
      border: 1px solid var(--primary);
    }

    .btn-outline:hover {
      background: rgba(37, 99, 235, 0.1);
    }

    .btn-lg {
      padding: 14px 28px;
      font-size: 1.1rem;
      height: 56px;
    }

    /* 统计卡片 */
    .stats-container {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
      gap: 25px;
      margin-bottom: 30px;
    }

    .stat-card {
      background: rgba(255, 255, 255, 0.05);
      border-radius: 16px;
      padding: 25px;
      box-shadow: var(--card-shadow);
      border-left: 4px solid var(--primary);
      backdrop-filter: blur(8px);
      transition: all 0.3s;
    }

    .stat-card:hover {
      background: rgba(255, 255, 255, 0.08);
    }

    .stat-card.warning {
      border-left-color: var(--warning);
    }

    .stat-card.success {
      border-left-color: var(--success);
    }

    .stat-title {
      font-size: 0.95rem;
      color: var(--gray);
      margin-bottom: 12px;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .stat-value {
      font-size: 2.2rem;
      font-weight: 700;
      color: white;
    }

    .stat-trend {
      font-size: 0.9rem;
      margin-top: 8px;
      display: flex;
      align-items: center;
      gap: 5px;
    }

    .trend-up {
      color: var(--success);
    }

    .trend-down {
      color: var(--danger);
    }

    /* 快速扫描区域 */
    .scanner-area {
      background: rgba(15, 23, 42, 0.7);
      border: 3px dashed var(--primary);
      border-radius: 16px;
      height: 230px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      margin-bottom: 25px;
      cursor: pointer;
      transition: all 0.3s;
      position: relative;
      overflow: hidden;
    }

    .scanner-area::before {
      content: '';
      position: absolute;
      top: -50%;
      left: -50%;
      width: 200%;
      height: 200%;
      background: linear-gradient(45deg, transparent, rgba(37, 99, 235, 0.1), transparent);
      animation: scanAnimation 3s infinite linear;
      z-index: 0;
    }

    @keyframes scanAnimation {
      0% { transform: rotate(0deg); }
      100% { transform: rotate(360deg); }
    }

    .scanner-area .content {
      position: relative;
      z-index: 1;
      text-align: center;
    }

    .scanner-area i {
      font-size: 4.5rem;
      color: rgba(255, 255, 255, 0.8);
      margin-bottom: 20px;
      transition: all 0.3s;
    }

    .scanner-text {
      font-size: 1.3rem;
      font-weight: 500;
      color: white;
      transition: all 0.3s;
    }

    .scanner-area:hover i,
    .scanner-area:hover .scanner-text {
      color: white;
      transform: scale(1.05);
    }

    /* 表单元素 */
    .form-group {
      margin-bottom: 25px;
    }

    .form-label {
      display: block;
      margin-bottom: 10px;
      font-weight: 500;
      color: rgba(255, 255, 255, 0.85);
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .form-control {
      width: 100%;
      padding: 14px 18px;
      background: rgba(15, 23, 42, 0.5);
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 12px;
      font-size: 1rem;
      transition: all 0.3s;
      color: white;
    }

    .form-control:focus {
      border-color: var(--primary);
      outline: none;
      box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
      background: rgba(15, 23, 42, 0.7);
    }

    .form-row {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
      gap: 20px;
    }

    /* 表格样式 */
    .table {
      width: 100%;
      border-collapse: separate;
      border-spacing: 0;
    }

    .table th,
    .table td {
      padding: 16px 18px;
      text-align: left;
      border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .table th {
      background: rgba(30, 41, 59, 0.9);
      font-weight: 600;
      color: var(--primary);
      font-size: 0.95rem;
    }

    .table tr {
      transition: all 0.2s;
    }

    .table tr:hover {
      background: rgba(37, 99, 235, 0.08);
    }

    /* 利润显示 */
    .profit {
      font-weight: 700;
      font-size: 1.1rem;
    }

    .profit.positive {
      color: var(--success);
    }

    .profit.negative {
      color: var(--danger);
    }

    /* 徽章 */
    .badge {
      padding: 5px 12px;
      border-radius: 20px;
      font-size: 0.85rem;
      font-weight: 500;
    }

    .badge.success {
      background: rgba(16, 185, 129, 0.15);
      color: var(--success);
    }

    .badge.warning {
      background: rgba(245, 158, 11, 0.15);
      color: var(--warning);
    }

    .badge.danger {
      background: rgba(239, 68, 68, 0.15);
      color: var(--danger);
    }

    /* 工具提示 */
    .tooltip {
      position: relative;
      display: inline-block;
      cursor: help;
      border-bottom: 1px dashed rgba(255, 255, 255, 0.4);
    }

    .tooltip .tooltip-text {
      visibility: hidden;
      width: 200px;
      background: rgba(30, 41, 59, 0.95);
      color: white;
      text-align: center;
      border-radius: 8px;
      padding: 10px;
      position: absolute;
      z-index: 1;
      bottom: 125%;
      left: 50%;
      transform: translateX(-50%);
      opacity: 0;
      transition: opacity 0.3s;
      font-size: 0.9rem;
      border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .tooltip:hover .tooltip-text {
      visibility: visible;
      opacity: 1;
    }

    /* 响应式调整 */
    @media (max-width: 768px) {
      .sidebar {
        width: 100%;
        height: auto;
        flex-direction: row;
        padding: 0;
        overflow-x: auto;
      }

      .logo {
        margin: 10px 20px;
      }

      .nav-item {
        padding: 15px 10px;
        min-width: 70px;
      }

      .main-content {
        padding: 15px;
      }

      .stats-container {
        grid-template-columns: 1fr;
      }
    }
  </style>
</head>
<body>
<!-- 竖屏提示 -->
<div class="orientation-warning">
  <i class="fas fa-sync-alt"></i>
  <h2>请将手机旋转为横屏模式</h2>
  <p>为获得最佳操作体验，请在柜台使用横屏模式进行操作</p>
</div>

<div class="container">
  <!-- 侧边导航 -->
  <div class="sidebar">
    <div class="logo">
      <i class="fas fa-store"></i>
    </div>
    <div class="nav-item active" data-target="dashboard">
      <i class="fas fa-home"></i>
      <div class="label">首页</div>
    </div>
    <div class="nav-item" data-target="input">
      <i class="fas fa-barcode"></i>
      <div class="label">入库</div>
    </div>
    <div class="nav-item" data-target="sales">
      <i class="fas fa-cash-register"></i>
      <div class="label">销售</div>
    </div>
    <div class="nav-item" data-target="inventory">
      <i class="fas fa-boxes"></i>
      <div class="label">库存</div>
    </div>
    <div class="nav-item" data-target="reports">
      <i class="fas fa-chart-line"></i>
      <div class="label">报表</div>
    </div>
    <div class="nav-item" data-target="settings">
      <i class="fas fa-cog"></i>
      <div class="label">设置</div>
    </div>
  </div>

  <!-- 主内容区域 -->
  <div class="main-content">
    <!-- 仪表盘页面 -->
    <div class="page active" id="dashboard">
      <div class="page-header">
        <div>
          <h1 class="page-title">超市经营概览</h1>
          <p class="page-subtitle">今日经营数据实时更新</p>
        </div>
        <div class="date-display">
          2023年10月28日 周六
        </div>
      </div>

      <!-- 统计卡片 -->
      <div class="stats-container">
        <div class="stat-card">
          <div class="stat-title">
            <i class="fas fa-shopping-cart"></i> 今日销售额
          </div>
          <div class="stat-value">¥2,845</div>
          <div class="stat-trend trend-up">
            <i class="fas fa-arrow-up"></i> 12.5% 较昨日
          </div>
        </div>
        <div class="stat-card success">
          <div class="stat-title">
            <i class="fas fa-coins"></i> 今日利润
          </div>
          <div class="stat-value">¥683</div>
          <div class="stat-trend trend-up">
            <i class="fas fa-arrow-up"></i> 8.3% 较昨日
          </div>
        </div>
        <div class="stat-card">
          <div class="stat-title">
            <i class="fas fa-receipt"></i> 今日交易数
          </div>
          <div class="stat-value">47</div>
          <div class="stat-trend trend-down">
            <i class="fas fa-arrow-down"></i> 3.8% 较昨日
          </div>
        </div>
        <div class="stat-card warning">
          <div class="stat-title">
            <i class="fas fa-exclamation-triangle"></i> 需补货商品
          </div>
          <div class="stat-value">8</div>
          <div class="stat-trend trend-down">
            <i class="fas fa-arrow-down"></i> 减少2个
          </div>
        </div>
      </div>

      <!-- 快速操作 -->
      <div class="card">
        <div class="card-header">
          <h2 class="card-title"><i class="fas fa-bolt"></i> 快速操作</h2>
        </div>
        <div class="grid-buttons" style="display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 20px;">
          <button class="btn btn-primary" onclick="navigateTo('input')">
            <i class="fas fa-barcode"></i> 商品入库
          </button>
          <button class="btn btn-primary" onclick="navigateTo('sales')">
            <i class="fas fa-shopping-cart"></i> 销售收银
          </button>
          <button class="btn btn-primary" onclick="navigateTo('inventory')">
            <i class="fas fa-clipboard-list"></i> 库存盘点
          </button>
          <button class="btn btn-primary" onclick="navigateTo('reports')">
            <i class="fas fa-file-invoice-dollar"></i> 利润报表
          </button>
        </div>
      </div>

      <!-- 库存预警 -->
      <div class="card">
        <div class="card-header">
          <h2 class="card-title"><i class="fas fa-exclamation-circle"></i> 库存预警</h2>
          <button class="btn btn-outline">查看全部</button>
        </div>
        <table class="table">
          <thead>
          <tr>
            <th>商品名称</th>
            <th>当前库存</th>
            <th>预警值</th>
            <th>状态</th>
          </tr>
          </thead>
          <tbody>
          <tr>
            <td>康师傅红烧牛肉面 <span class="tooltip">(箱)<span class="tooltip-text">每箱24袋装</span></span></td>
            <td>12</td>
            <td>20</td>
            <td><span class="badge warning">需补货</span></td>
          </tr>
          <tr>
            <td>农夫山泉矿泉水 <span class="tooltip">(箱)<span class="tooltip-text">每箱24瓶装</span></span></td>
            <td>18</td>
            <td>30</td>
            <td><span class="badge warning">需补货</span></td>
          </tr>
          <tr>
            <td>清风纸巾 <span class="tooltip">(提)<span class="tooltip-text">每提10包装</span></span></td>
            <td>8</td>
            <td>15</td>
            <td><span class="badge danger">紧急补货</span></td>
          </tr>
          </tbody>
        </table>
      </div>

      <!-- 利润排行榜 -->
      <div class="card">
        <div class="card-header">
          <h2 class="card-title"><i class="fas fa-trophy"></i> 商品利润榜</h2>
          <span>最近7天</span>
        </div>
        <table class="table">
          <thead>
          <tr>
            <th>商品名称</th>
            <th>销量</th>
            <th>销售额</th>
            <th>利润</th>
          </tr>
          </thead>
          <tbody>
          <tr>
            <td>黄鹤楼香烟</td>
            <td>86</td>
            <td>¥8,600</td>
            <td class="profit positive">¥1,720</td>
          </tr>
          <tr>
            <td>飞天茅台</td>
            <td>12</td>
            <td>¥35,880</td>
            <td class="profit positive">¥7,176</td>
          </tr>
          <tr>
            <td>红牛功能饮料</td>
            <td>142</td>
            <td>¥1,704</td>
            <td class="profit positive">¥511</td>
          </tr>
          </tbody>
        </table>
      </div>
    </div>

    <!-- 商品入库页面 -->
    <div class="page" id="input">
      <div class="page-header">
        <div>
          <h1 class="page-title">商品入库管理</h1>
          <p class="page-subtitle">扫码或手动录入商品信息</p>
        </div>
        <button class="btn btn-outline" onclick="navigateTo('dashboard')">
          <i class="fas fa-arrow-left"></i> 返回首页
        </button>
      </div>

      <div class="card">
        <div class="scanner-area" onclick="simulateScan()">
          <div class="content">
            <i class="fas fa-barcode"></i>
            <div class="scanner-text">点击扫码或使用扫码枪</div>
          </div>
        </div>

        <div class="form-group">
          <label class="form-label"><i class="fas fa-barcode"></i> 商品条码</label>
          <input type="text" class="form-control" id="barcodeInput" placeholder="输入商品条码或扫码">
        </div>

        <div class="form-row">
          <div class="form-group">
            <label class="form-label"><i class="fas fa-box"></i> 商品名称</label>
            <input type="text" class="form-control" placeholder="自动识别或手动输入">
          </div>
          <div class="form-group">
            <label class="form-label"><i class="fas fa-boxes"></i> 商品分类</label>
            <select class="form-control">
              <option>食品饮料</option>
              <option>日化用品</option>
              <option>烟酒副食</option>
              <option>生活用品</option>
            </select>
          </div>
        </div>

        <div class="form-row">
          <div class="form-group">
            <label class="form-label"><i class="fas fa-tags"></i> 进货价 (¥)</label>
            <input type="number" class="form-control" placeholder="0.00">
          </div>
          <div class="form-group">
            <label class="form-label"><i class="fas fa-tag"></i> 销售价 (¥)</label>
            <input type="number" class="form-control" placeholder="0.00">
          </div>
          <div class="form-group">
            <label class="form-label"><i class="fas fa-cubes"></i> 入库数量</label>
            <input type="number" class="form-control" value="1">
          </div>
        </div>

        <button class="btn btn-primary btn-lg" style="width: 100%; margin-top: 15px;">
          <i class="fas fa-save"></i> 确认入库
        </button>
      </div>

      <div class="card">
        <div class="card-header">
          <h2 class="card-title"><i class="fas fa-history"></i> 最近入库记录</h2>
          <div class="btn-group">
            <button class="btn btn-outline"><i class="fas fa-filter"></i> 筛选</button>
            <button class="btn btn-outline"><i class="fas fa-download"></i> 导出</button>
          </div>
        </div>
        <table class="table">
          <thead>
          <tr>
            <th>商品</th>
            <th>时间</th>
            <th>数量</th>
            <th>操作员</th>
          </tr>
          </thead>
          <tbody>
          <tr>
            <td>可口可乐 330ml</td>
            <td>10:25</td>
            <td>24</td>
            <td>张老板</td>
          </tr>
          <tr>
            <td>奥利奥饼干（巧克力味）</td>
            <td>09:48</td>
            <td>12</td>
            <td>张老板</td>
          </tr>
          <tr>
            <td>金龙鱼大豆油 5L</td>
            <td>昨天</td>
            <td>6</td>
            <td>李店员</td>
          </tr>
          </tbody>
        </table>
      </div>
    </div>

    <!-- 销售收银页面 -->
    <div class="page" id="sales">
      <div class="page-header">
        <div>
          <h1 class="page-title">销售收银台</h1>
          <p class="page-subtitle">扫码商品进行收银结算</p>
        </div>
        <button class="btn btn-outline" onclick="navigateTo('dashboard')">
          <i class="fas fa-arrow-left"></i> 返回首页
        </button>
      </div>

      <div class="card">
        <div class="scanner-area" onclick="simulateSaleScan()">
          <div class="content">
            <i class="fas fa-barcode"></i>
            <div class="scanner-text">点击扫码或使用扫码枪</div>
          </div>
        </div>

        <div class="cart-items">
          <table class="table">
            <thead>
            <tr>
              <th>商品</th>
              <th>单价</th>
              <th>数量</th>
              <th>小计</th>
              <th>利润</th>
            </tr>
            </thead>
            <tbody>
            <tr>
              <td>康师傅红烧牛肉面</td>
              <td>¥4.50</td>
              <td>2</td>
              <td>¥9.00</td>
              <td class="profit positive">¥2.60</td>
            </tr>
            <tr>
              <td>农夫山泉矿泉水</td>
              <td>¥2.00</td>
              <td>3</td>
              <td>¥6.00</td>
              <td class="profit positive">¥3.60</td>
            </tr>
            <tr>
              <td>双汇火腿肠王中王</td>
              <td>¥1.50</td>
              <td>5</td>
              <td>¥7.50</td>
              <td class="profit positive">¥3.00</td>
            </tr>
            </tbody>
          </table>
        </div>

        <div class="card" style="margin-top: 20px; background: rgba(15, 23, 42, 0.9);">
          <div style="display: flex; justify-content: space-between; margin-bottom: 15px; font-size: 1.1rem;">
            <span>商品数量:</span>
            <span><strong>3</strong></span>
          </div>
          <div style="display: flex; justify-content: space-between; margin-bottom: 15px; font-size: 1.1rem;">
            <span>商品总价:</span>
            <span><strong>¥22.50</strong></span>
          </div>
          <div style="display: flex; justify-content: space-between; margin-bottom: 15px; font-size: 1.2rem; padding-top: 15px; border-top: 1px solid rgba(255,255,255,0.1);">
            <span>预计总利润:</span>
            <span class="profit positive"><strong>¥9.20</strong></span>
          </div>
        </div>

        <div class="payment-actions" style="display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 20px; margin-top: 25px;">
          <button class="btn btn-primary">
            <i class="fas fa-money-bill-wave"></i> 现金支付
          </button>
          <button class="btn btn-primary">
            <i class="fab fa-alipay"></i> 支付宝支付
          </button>
          <button class="btn btn-primary">
            <i class="fab fa-weixin"></i> 微信支付
          </button>
          <button class="btn btn-outline">
            <i class="fas fa-print"></i> 打印小票
          </button>
        </div>
      </div>
    </div>

    <!-- 库存管理页面 -->
    <div class="page" id="inventory">
      <div class="page-header">
        <div>
          <h1 class="page-title">库存管理</h1>
          <p class="page-subtitle">当前库存商品情况</p>
        </div>
        <button class="btn btn-outline" onclick="navigateTo('dashboard')">
          <i class="fas fa-arrow-left"></i> 返回首页
        </button>
      </div>

      <div class="card">
        <div class="card-header">
          <h2 class="card-title"><i class="fas fa-boxes"></i> 库存概览</h2>
          <button class="btn btn-primary">
            <i class="fas fa-plus"></i> 新增商品
          </button>
        </div>

        <div class="form-group">
          <label class="form-label"><i class="fas fa-search"></i> 搜索商品</label>
          <input type="text" class="form-control" placeholder="输入商品名称或条码">
        </div>

        <table class="table">
          <thead>
          <tr>
            <th>商品名称</th>
            <th>条码</th>
            <th>库存</th>
            <th>进价</th>
            <th>售价</th>
            <th>利润</th>
            <th>操作</th>
          </tr>
          </thead>
          <tbody>
          <tr>
            <td>康师傅红烧牛肉面</td>
            <td>6920152411028</td>
            <td>12</td>
            <td>¥3.20</td>
            <td>¥4.50</td>
            <td class="profit positive">¥1.30</td>
            <td>
              <button class="btn btn-outline" style="padding: 8px 12px;">
                <i class="fas fa-edit"></i>
              </button>
            </td>
          </tr>
          <tr>
            <td>农夫山泉矿泉水</td>
            <td>6921168590018</td>
            <td>18</td>
            <td>¥0.80</td>
            <td>¥2.00</td>
            <td class="profit positive">¥1.20</td>
            <td>
              <button class="btn btn-outline" style="padding: 8px 12px;">
                <i class="fas fa-edit"></i>
              </button>
            </td>
          </tr>
          <tr>
            <td>双汇火腿肠</td>
            <td>6902890234099</td>
            <td>36</td>
            <td>¥0.90</td>
            <td>¥1.50</td>
            <td class="profit positive">¥0.60</td>
            <td>
              <button class="btn btn-outline" style="padding: 8px 12px;">
                <i class="fas fa-edit"></i>
              </button>
            </td>
          </tr>
          <tr>
            <td>清风纸巾（金装）</td>
            <td>6926410328120</td>
            <td>8</td>
            <td>¥8.50</td>
            <td>¥12.00</td>
            <td class="profit positive">¥3.50</td>
            <td>
              <button class="btn btn-outline" style="padding: 8px 12px;">
                <i class="fas fa-edit"></i>
              </button>
            </td>
          </tr>
          </tbody>
        </table>
      </div>
    </div>
  </div>
</div>

<script>
  // 页面导航功能
  function navigateTo(pageId) {
    // 隐藏所有页面
    document.querySelectorAll('.page').forEach(page => {
      page.classList.remove('active');
    });

    // 显示目标页面
    document.getElementById(pageId).classList.add('active');

    // 更新导航激活状态
    document.querySelectorAll('.nav-item').forEach(item => {
      item.classList.remove('active');
    });

    // 找到对应的导航项并激活
    document.querySelector(`.nav-item[data-target="${pageId}"]`).classList.add('active');
  }

  // 导航项点击事件
  document.querySelectorAll('.nav-item').forEach(item => {
    item.addEventListener('click', function() {
      const targetPage = this.getAttribute('data-target');
      navigateTo(targetPage);
    });
  });

  // 模拟扫码功能
  function simulateScan() {
    const barcodeInput = document.getElementById('barcodeInput');
    const sampleBarcodes = [
      '6920152411028', // 康师傅
      '6926410328120', // 清风纸巾
      '6902890234099', // 双汇火腿肠
      '6921168590018'  // 农夫山泉
    ];

    const randomBarcode = sampleBarcodes[Math.floor(Math.random() * sampleBarcodes.length)];

    // 显示扫描动画效果
    const scannerArea = document.querySelector('.scanner-area');
    const originalContent = scannerArea.querySelector('.content');

    originalContent.style.opacity = '0';

    const scanningText = document.createElement('div');
    scanningText.className = 'content';
    scanningText.innerHTML = `
                <i class="fas fa-barcode fa-flip" style="font-size: 4.5rem; color: #3b82f6;"></i>
                <div class="scanner-text" style="color: #3b82f6;">扫描中...</div>
            `;
    scannerArea.appendChild(scanningText);

    // 模拟扫描过程
    setTimeout(() => {
      scannerArea.removeChild(scanningText);
      originalContent.style.opacity = '1';

      barcodeInput.value = randomBarcode;
      barcodeInput.focus();

      // 显示成功提示
      const successText = document.createElement('div');
      successText.className = 'content';
      successText.innerHTML = `
                    <i class="fas fa-check-circle" style="font-size: 4.5rem; color: #10b981;"></i>
                    <div class="scanner-text" style="color: #10b981;">扫描成功！</div>
                `;
      scannerArea.appendChild(successText);

      setTimeout(() => {
        scannerArea.removeChild(successText);
        originalContent.style.opacity = '1';
      }, 2000);
    }, 1500);
  }

  // 模拟销售扫码
  function simulateSaleScan() {
    const scannerArea = document.querySelectorAll('.scanner-area')[1];
    const originalContent = scannerArea.querySelector('.content');

    originalContent.style.opacity = '0';

    const scanningText = document.createElement('div');
    scanningText.className = 'content';
    scanningText.innerHTML = `
                <i class="fas fa-barcode fa-flip" style="font-size: 4.5rem; color: #3b82f6;"></i>
                <div class="scanner-text" style="color: #3b82f6;">扫描中...</div>
            `;
    scannerArea.appendChild(scanningText);

    setTimeout(() => {
      scannerArea.removeChild(scanningText);
      originalContent.style.opacity = '1';

      const successText = document.createElement('div');
      successText.className = 'content';
      successText.innerHTML = `
                    <i class="fas fa-check-circle" style="font-size: 4.5rem; color: #10b981;"></i>
                    <div class="scanner-text" style="color: #10b981;">商品已添加！</div>
                `;
      scannerArea.appendChild(successText);

      setTimeout(() => {
        scannerArea.removeChild(successText);
        originalContent.style.opacity = '1';
      }, 1500);
    }, 1000);
  }

  // 初始化页面
  document.addEventListener('DOMContentLoaded', function() {
    // 设置首页为活动状态
    navigateTo('dashboard');
  });
</script>
</body>
</html>